HAL XSPI Functions ¶
Initialization and deinitialization functions ¶
- group XSPI_Exported_Functions_Group1
-
This subsection provides a set of functions allowing to initialize and deinitialize the XSPIx peripheral:
Call the function HAL_XSPI_Init() to initialize the selected HAL XSPI handle and associate an XSPI peripheral instance.
Call the function HAL_XSPI_DeInit() to de-initialize the given HAL XSPI instance by stopping any ongoing process and resetting the state machine.
Functions
-
hal_status_t
HAL_XSPI_Init
(
hal_xspi_handle_t
*
hxspi
,
hal_xspi_t
instance
)
¶
-
Initialize the XSPI according to the associated instance.
Note
The XSPI clock can be activated within the HAL_XSPI_Init() function by setting the USE_XSPI_CLK_ENABLE_MODEL flag to HAL_CLK_ENABLE_XSPI_ONLY in the configuration file ** stm32tnxx_hal_conf.h **.
- Parameters :
-
instance – XSPI instance, can be one of the XSPI instances as defined in the CMSIS device header file.
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter.
HAL_OK – hxspi instance has been correctly Initialized.
-
void
HAL_XSPI_DeInit
(
hal_xspi_handle_t
*
hxspi
)
¶
-
De-Initialize the XSPI peripheral.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
XSPI Configuration functions ¶
- group XSPI_Exported_Functions_Group2
-
This subsection provides a set of functions to configure the XSPIx peripheral:
There are three categories of HAL configuration APIs:
Global configuration APIs:
HAL_XSPI_SetConfig() Set the HAL peripheral instance into a ready-to-use state (idle) according to the user parameters
HAL_XSPI_GetConfig() Retrieve the HAL peripheral configuration
Unitary configuration APIs:
HAL_XSPI_SetFifoThreshold() Configure the FIFO threshold according to the user parameters.
HAL_XSPI_GetFifoThreshold() Retrieve the FIFO threshold configuration.
HAL_XSPI_SetPrescaler() Configure the prescaler according to the user parameters.
HAL_XSPI_GetPrescaler() Retrieve the prescaler configuration.
HAL_XSPI_SetMemorySize() Configure the XSPI memory size according to the user parameters.
HAL_XSPI_GetMemorySize() Retrieve the XSPI memory size configuration.
HAL_XSPI_SetMemoryType() Configure the XSPI memory type according to the user parameters.
HAL_XSPI_GetMemoryType() Retrieve the XSPI memory type configuration.
HAL_XSPI_SetMemorySelection() Configure the nCS used for memory selection.
HAL_XSPI_GetMemorySelection() Retrieve the nCS used for memory selection.
HAL_XSPI_EnableFreeRunningClock() Enable the free-running clock.
HAL_XSPI_DisableFreeRunningClock() Disable the free-running clock.
HAL_XSPI_IsEnabledFreeRunningClock() Check whether the free-running clock is enabled.
HAL_XSPI_EnablePrefetchData() Enable automatic prefetch in the external memory (reset value).
HAL_XSPI_DisablePrefetchData() Disable automatic prefetch in the external memory.
HAL_XSPI_IsEnabledPrefetchData() Check the state of automatic prefetch in the external memory.
These APIs are intended to dynamically modify/retrieve a unitary item, meaning that a global configuration has already been applied. Unitary configuration APIs must first check whether the driver is in the IDLE state (meaning a global configuration was applied) in order to modify or retrieve a single item. Items that can alter other configuration parameters must not be handled within unitary APIs.
Functions
-
hal_status_t
HAL_XSPI_SetConfig
(
hal_xspi_handle_t
*
hxspi
,
const
hal_xspi_config_t
*
p_config
)
¶
-
Configure the XSPI according to the user parameters.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
p_config – Pointer to the hal_xspi_config_t structure.
- Return values :
-
HAL_ERROR – XSPI instance is already configured and can not be modified.
HAL_INVALID_PARAM – Invalid parameter.
HAL_OK – XSPI instance has been correctly configured.
-
void
HAL_XSPI_GetConfig
(
hal_xspi_handle_t
*
hxspi
,
hal_xspi_config_t
*
p_config
)
¶
-
Get the XSPI configuration.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
p_config – Pointer to the hal_xspi_config_t structure.
-
hal_status_t
HAL_XSPI_SetFifoThreshold
(
hal_xspi_handle_t
*
hxspi
,
uint32_t
threshold
)
¶
-
Set the XSPI FIFO threshold.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
threshold – Threshold of the FIFO can be a value from 0 to 31.
- Return values :
-
HAL_OK – FIFO threshold has been correctly configured.
-
uint32_t
HAL_XSPI_GetFifoThreshold
(
const
hal_xspi_handle_t
*
hxspi
)
¶
-
Get the XSPI FIFO threshold.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
- Returns :
-
Retrieve the FIFO threshold value.
-
hal_status_t
HAL_XSPI_SetPrescaler
(
hal_xspi_handle_t
*
hxspi
,
uint32_t
clk_prescaler
)
¶
-
Set XSPI Clock Prescaler.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
clk_prescaler – Prescaler generating the external clock can be a value from 0 to 255.
- Return values :
-
HAL_ERROR – An error has occurred.
HAL_OK – Clock Prescaler has been correctly configured.
-
uint32_t
HAL_XSPI_GetPrescaler
(
const
hal_xspi_handle_t
*
hxspi
)
¶
-
Get XSPI Clock Prescaler.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
- Returns :
-
Retrieve the value clock prescaler.
-
hal_status_t
HAL_XSPI_SetMemorySize
(
hal_xspi_handle_t
*
hxspi
,
hal_xspi_memory_size_t
size
)
¶
-
Configure device memory size.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
size – The size of the external device connected to the XSPI.
- Return values :
-
HAL_OK – Size has been correctly configured.
-
hal_xspi_memory_size_t
HAL_XSPI_GetMemorySize
(
const
hal_xspi_handle_t
*
hxspi
)
¶
-
Get XSPI Memory Size.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
- Returns :
-
Retrieve the value device memory size.
-
hal_status_t
HAL_XSPI_SetMemoryType
(
hal_xspi_handle_t
*
hxspi
,
hal_xspi_memory_type_t
type
)
¶
-
Set XSPI Memory Type.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
type – The type of the external device connected to the XSPI.
- Return values :
-
HAL_OK – Type has been correctly configured.
-
hal_xspi_memory_type_t
HAL_XSPI_GetMemoryType
(
const
hal_xspi_handle_t
*
hxspi
)
¶
-
Get XSPI Memory Type.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
- Returns :
-
Retrieve the type of the external device connected to the XSPI.
-
hal_status_t
HAL_XSPI_SetMemorySelection
(
hal_xspi_handle_t
*
hxspi
,
hal_xspi_memory_selection_t
select
)
¶
-
Set XSPI Memory Selection.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
select – The nCS use by the XSPI to select the external device.
- Return values :
-
HAL_OK – Type has been correctly configured.
-
hal_xspi_memory_selection_t
HAL_XSPI_GetMemorySelection
(
const
hal_xspi_handle_t
*
hxspi
)
¶
-
Get XSPI Memory Selection.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
- Returns :
-
Retrieve the nCS used to select the external device connected to the XSPI.
-
uint32_t
HAL_XSPI_GetMemoryMappedBaseAddress
(
const
hal_xspi_handle_t
*
hxspi
)
¶
-
Get Base Address of XSPI in Memory-Mapped mode.
- Parameters :
-
hxspi – XSPI handle.
- Returns :
-
Retrieve the base address of the XSPI peripheral (or 0U in case of error).
-
hal_status_t
HAL_XSPI_EnableFreeRunningClock
(
hal_xspi_handle_t
*
hxspi
)
¶
-
Enable the free running clock.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
- Return values :
-
HAL_OK – free running clock has been correctly enabled.
-
hal_status_t
HAL_XSPI_DisableFreeRunningClock
(
hal_xspi_handle_t
*
hxspi
)
¶
-
Disable the free running clock.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
- Return values :
-
HAL_OK – free running clock has been correctly disabled.
-
hal_xspi_free_running_clk_status_t
HAL_XSPI_IsEnabledFreeRunningClock
(
const
hal_xspi_handle_t
*
hxspi
)
¶
-
Check whether the free running clock is enabled or disabled.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
- Returns :
-
Retrieve the state of the free running clock.
-
hal_status_t
HAL_XSPI_EnablePrefetchData
(
hal_xspi_handle_t
*
hxspi
)
¶
-
Enable automatic prefetch in the external memory (Enabled by default).
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
- Return values :
-
HAL_OK – automatic prefetch has been correctly enabled.
-
hal_status_t
HAL_XSPI_DisablePrefetchData
(
hal_xspi_handle_t
*
hxspi
)
¶
-
Disable automatic prefetch in the external memory.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
- Return values :
-
HAL_OK – automatic prefetch has been correctly disabled.
-
hal_xspi_prefetch_data_status_t
HAL_XSPI_IsEnabledPrefetchData
(
const
hal_xspi_handle_t
*
hxspi
)
¶
-
Check whether the automatic prefetch is enabled or disabled.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
- Returns :
-
Retrieve the state of the automatic prefetch.
XSPI Command and I/O operation functions ¶
- group XSPI_Exported_Functions_Group3
-
This subsection provides a set of functions allowing to manage the data transfer from/to external memory
HAL_XSPI_StartMemoryMappedMode() Allowing to start a XSPI Memory-Mapped mode according to the user parameters
HAL_XSPI_StopMemoryMappedMode() Allowing to stop a XSPI Memory-Mapped mode
There are 3 categories of HAL functions APIs to manage the data transfer
Blocking mode: Polling
Non-Blocking mode: IT
Non-Blocking mode: DMA
Functions
-
hal_status_t
HAL_XSPI_StartMemoryMappedMode
(
hal_xspi_handle_t
*
hxspi
,
const
hal_xspi_memory_mapped_config_t
*
p_config
)
¶
-
Start the Memory Mapped mode.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
p_config – Pointer to structure that contains the memory mapped configuration information.
- Return values :
-
HAL_ERROR – An error has occurred.
HAL_INVALID_PARAM – Invalid parameter.
HAL_BUSY – XSPI state is active when calling this API.
HAL_OK – XSPI instance has been correctly configured.
-
hal_status_t
HAL_XSPI_StopMemoryMappedMode
(
hal_xspi_handle_t
*
hxspi
)
¶
-
Stop the Memory Mapped mode.
Note
This function is used only in Memory mapped Mode.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
- Return values :
-
HAL_ERROR – An error has occurred.
HAL_OK – XSPI instance has been correctly configured.
-
hal_status_t
HAL_XSPI_SendRegularCmd
(
hal_xspi_handle_t
*
hxspi
,
const
hal_xspi_regular_cmd_t
*
p_cmd
,
uint32_t
timeout_ms
)
¶
-
Set the Regular command configuration.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
p_cmd – Structure that contains the Regular command configuration information.
timeout_ms – Timeout duration.
- Return values :
-
HAL_ERROR – An error has occurred.
HAL_INVALID_PARAM – Invalid parameter.
HAL_TIMEOUT – In case of user timeout.
HAL_BUSY – XSPI state is active when calling this API.
HAL_OK – Operation completed.
-
hal_status_t
HAL_XSPI_SendRegularCmd_IT
(
hal_xspi_handle_t
*
hxspi
,
const
hal_xspi_regular_cmd_t
*
p_cmd
)
¶
-
Set the Regular command configuration in interrupt mode.
Note
This function is used only in Indirect Read or Write Modes.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
p_cmd – Structure that contains the Regular command configuration information.
- Return values :
-
HAL_ERROR – An error has occurred.
HAL_INVALID_PARAM – Invalid parameter.
HAL_BUSY – XSPI state is active when calling this API.
HAL_OK – Operation completed.
-
hal_status_t
HAL_XSPI_SendHyperbusCmd
(
hal_xspi_handle_t
*
hxspi
,
const
hal_xspi_hyperbus_cmd_t
*
p_cmd
,
uint32_t
timeout_ms
)
¶
-
Set the Hyperbus command configuration.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
p_cmd – Structure containing the Hyperbus command.
timeout_ms – Timeout duration.
- Return values :
-
HAL_ERROR – An error has occurred.
HAL_INVALID_PARAM – Invalid parameter.
HAL_TIMEOUT – In case of user timeout.
HAL_BUSY – XSPI state is active when calling this API.
HAL_OK – Operation completed.
-
hal_status_t
HAL_XSPI_ExecRegularAutoPoll
(
hal_xspi_handle_t
*
hxspi
,
const
hal_xspi_auto_polling_config_t
*
p_config
,
uint32_t
timeout_ms
)
¶
-
Execute the XSPI Automatic Polling Mode in blocking mode.
Note
This function is used only in Automatic Polling Mode for Regular protocol.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
p_config – Pointer to structure that contains the polling configuration information.
timeout_ms – Timeout duration.
- Return values :
-
HAL_ERROR – An error has occurred.
HAL_INVALID_PARAM – Invalid parameter.
HAL_TIMEOUT – In case of user timeout.
HAL_BUSY – XSPI state is active when calling this API.
HAL_OK – Operation completed.
-
hal_status_t
HAL_XSPI_ExecRegularAutoPoll_IT
(
hal_xspi_handle_t
*
hxspi
,
const
hal_xspi_auto_polling_config_t
*
p_config
)
¶
-
Execute the XSPI Automatic Polling Mode in non-blocking mode.
Note
This function is used only in Automatic Polling Mode for Regular protocol.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
p_config – Pointer to structure that contains the polling configuration information
- Return values :
-
HAL_ERROR – An error has occurred.
HAL_INVALID_PARAM – Invalid parameter.
HAL_BUSY – XSPI state is active when calling this API.
HAL_OK – Operation completed.
-
hal_status_t
HAL_XSPI_Transmit
(
hal_xspi_handle_t
*
hxspi
,
const
void
*
p_data
,
uint32_t
timeout_ms
)
¶
-
Transmit an amount of data in blocking mode.
Note
This function is used only in Indirect Write Mode.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
p_data – Pointer to data buffer.
timeout_ms – Timeout duration.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter.
HAL_TIMEOUT – In case of user timeout.
HAL_BUSY – XSPI state is active when calling this API.
HAL_OK – Transfer completed.
-
hal_status_t
HAL_XSPI_Receive
(
hal_xspi_handle_t
*
hxspi
,
void
*
p_data
,
uint32_t
timeout_ms
)
¶
-
Receive an amount of data in blocking mode.
Note
This function is used only in Indirect Read Mode.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
p_data – Pointer to data buffer.
timeout_ms – Timeout duration.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter.
HAL_TIMEOUT – In case of user timeout.
HAL_BUSY – XSPI state is active when calling this API.
HAL_OK – Operation completed.
-
hal_status_t
HAL_XSPI_Transmit_IT
(
hal_xspi_handle_t
*
hxspi
,
const
void
*
p_data
)
¶
-
Send an amount of data in non-blocking mode with interrupt.
Note
This function is used only in Indirect Write Mode.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
p_data – Pointer to data buffer.
- Return values :
-
HAL_BUSY – XSPI state is active when calling this API.
HAL_INVALID_PARAM – Invalid parameter.
HAL_OK – Transfer completed.
-
hal_status_t
HAL_XSPI_Receive_IT
(
hal_xspi_handle_t
*
hxspi
,
void
*
p_data
)
¶
-
Receive an amount of data in non-blocking mode with interrupt.
Note
This function is used only in Indirect Read Mode.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
p_data – Pointer to data buffer.
- Return values :
-
HAL_ERROR – An error has occurred.
HAL_INVALID_PARAM – Invalid parameter.
HAL_BUSY – XSPI state is active when calling this API.
HAL_OK – Operation completed.
-
hal_status_t
HAL_XSPI_Transmit_DMA
(
hal_xspi_handle_t
*
hxspi
,
const
void
*
p_data
)
¶
-
Send an amount of data in non-blocking mode with DMA.
Note
This function is used only in Indirect Write Mode.
Warning
If DMA peripheral access is configured as halfword, the number of data and the FIFO threshold must be aligned on halfword.
Warning
If DMA peripheral access is configured as word, the number of data and the FIFO threshold must be aligned on word.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
p_data – Pointer to data buffer.
- Return values :
-
HAL_ERROR – An error has occurred.
HAL_INVALID_PARAM – Invalid parameter.
HAL_BUSY – XSPI state is active when calling this API.
HAL_OK – Operation completed.
-
hal_status_t
HAL_XSPI_Transmit_DMA_Opt
(
hal_xspi_handle_t
*
hxspi
,
const
void
*
p_data
,
uint32_t
interrupts
)
¶
-
Send an amount of data with DMA in interrupt mode with optional interrupts.
Note
This function is used only in Indirect Write Mode.
Warning
If DMA peripheral access is configured as halfword, the number of data and the FIFO threshold must be aligned on halfword.
Warning
If DMA peripheral access is configured as word, the number of data and the FIFO threshold must be aligned on word.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
p_data – Pointer to data buffer.
interrupts – Specifies the DMA optional interrupt to be enabled. This parameter can be one of Optional interrupts group.
- Return values :
-
HAL_ERROR – An error has occurred.
HAL_INVALID_PARAM – Invalid parameter.
HAL_BUSY – XSPI state is active when calling this API.
HAL_OK – Operation completed.
-
hal_status_t
HAL_XSPI_Receive_DMA
(
hal_xspi_handle_t
*
hxspi
,
void
*
p_data
)
¶
-
Receive an amount of data in non-blocking mode with DMA.
Note
This function is used only in Indirect Read Mode.
Warning
If DMA peripheral access is configured as halfword, the number of data and the FIFO threshold must be aligned on halfword.
Warning
If DMA peripheral access is configured as word, the number of data and the FIFO threshold must be aligned on word.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
p_data – Pointer to data buffer.
- Return values :
-
HAL_ERROR – An error has occurred.
HAL_INVALID_PARAM – Invalid parameter.
HAL_BUSY – XSPI state is active when calling this API.
HAL_OK – Operation completed.
-
hal_status_t
HAL_XSPI_Receive_DMA_Opt
(
hal_xspi_handle_t
*
hxspi
,
void
*
p_data
,
uint32_t
interrupts
)
¶
-
Receive an amount of data with DMA in interrupt mode with optional interrupts.
Note
This function is used only in Indirect Read Mode.
Warning
If DMA peripheral access is configured as halfword, the number of data and the FIFO threshold must be aligned on halfword.
Warning
If DMA peripheral access is configured as word, the number of data and the FIFO threshold must be aligned on word.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
p_data – Pointer to data buffer.
interrupts – Specifies the DMA optional interrupt to be enabled. This parameter can be one of Optional interrupts group.
- Return values :
-
HAL_ERROR – An error has occurred.
HAL_INVALID_PARAM – Invalid parameter.
HAL_BUSY – XSPI state is active when calling this API.
HAL_OK – Operation completed.
-
hal_status_t
HAL_XSPI_Abort
(
hal_xspi_handle_t
*
hxspi
,
uint32_t
timeout_ms
)
¶
-
Abort the current transmission.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
timeout_ms – Timeout duration.
- Return values :
-
HAL_TIMEOUT – In case of user timeout.
HAL_OK – Operation completed.
-
hal_status_t
HAL_XSPI_Abort_IT
(
hal_xspi_handle_t
*
hxspi
)
¶
-
Abort the current transmission (non-blocking function).
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
- Return values :
-
HAL_ERROR – An error has occurred.
HAL_OK – Operation completed.
IRQHandler, link DMA, and callback functions ¶
- group XSPI_Exported_Functions_Group4
-
This subsection provides a set callback functions allowing to manage the data transfer from/to external memory
Functions
-
void
HAL_XSPI_IRQHandler
(
hal_xspi_handle_t
*
hxspi
)
¶
-
Handle the XSPI interrupt request.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
-
void
HAL_XSPI_ErrorCallback
(
hal_xspi_handle_t
*
hxspi
)
¶
-
Error callback.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
-
void
HAL_XSPI_AbortCpltCallback
(
hal_xspi_handle_t
*
hxspi
)
¶
-
Abort completed callback.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
-
void
HAL_XSPI_FifoThresholdCallback
(
hal_xspi_handle_t
*
hxspi
)
¶
-
FIFO Threshold callback.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
-
void
HAL_XSPI_CmdCpltCallback
(
hal_xspi_handle_t
*
hxspi
)
¶
-
Command completed callback.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
-
void
HAL_XSPI_RxCpltCallback
(
hal_xspi_handle_t
*
hxspi
)
¶
-
Rx Transfer completed callback.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
-
void
HAL_XSPI_TxCpltCallback
(
hal_xspi_handle_t
*
hxspi
)
¶
-
Tx Transfer completed callback.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
-
void
HAL_XSPI_RxHalfCpltCallback
(
hal_xspi_handle_t
*
hxspi
)
¶
-
Rx Half Transfer completed callback.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
-
void
HAL_XSPI_TxHalfCpltCallback
(
hal_xspi_handle_t
*
hxspi
)
¶
-
Tx Half Transfer completed callback.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
-
void
HAL_XSPI_StatusMatchCallback
(
hal_xspi_handle_t
*
hxspi
)
¶
-
Status Match callback.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
-
hal_status_t
HAL_XSPI_RegisterErrorCallback
(
hal_xspi_handle_t
*
hxspi
,
hal_xspi_cb_t
p_callback
)
¶
-
Register the XSPI Error Callback to be used instead of the weak HAL_XSPI_ErrorCallback() predefined callback.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
p_callback – Specifies the error callback.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter.
HAL_OK – Register completed successfully.
-
hal_status_t
HAL_XSPI_RegisterCmdCpltCallback
(
hal_xspi_handle_t
*
hxspi
,
hal_xspi_cb_t
p_callback
)
¶
-
Register the XSPI command complete Callback TO be used instead of the weak HAL_XSPI_CmdCpltCallback() predefined callback.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
p_callback – Specifies the command complete callback.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter.
HAL_OK – Register completed successfully.
-
hal_status_t
HAL_XSPI_RegisterRxCpltCallback
(
hal_xspi_handle_t
*
hxspi
,
hal_xspi_cb_t
p_callback
)
¶
-
Register the XSPI Receive complete Callback TO be used instead of the weak HAL_XSPI_RxCpltCallback() predefined callback.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
p_callback – Specifies the receive complete callback.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter.
HAL_OK – Register completed successfully.
-
hal_status_t
HAL_XSPI_RegisterTxCpltCallback
(
hal_xspi_handle_t
*
hxspi
,
hal_xspi_cb_t
p_callback
)
¶
-
Register the XSPI Transfer complete Callback TO be used instead of the weak HAL_XSPI_TxCpltCallback() predefined callback.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
p_callback – Specifies the transfer complete callback.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter.
HAL_OK – Register completed successfully.
-
hal_status_t
HAL_XSPI_RegisterRxHalfCpltCallback
(
hal_xspi_handle_t
*
hxspi
,
hal_xspi_cb_t
p_callback
)
¶
-
Register the XSPI Receive Half complete Callback TO be used instead of the weak HAL_XSPI_RxHalfCpltCallback() predefined callback.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
p_callback – Specifies the half receive complete callback.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter.
HAL_OK – Register completed successfully.
-
hal_status_t
HAL_XSPI_RegisterTxHalfCpltCallback
(
hal_xspi_handle_t
*
hxspi
,
hal_xspi_cb_t
p_callback
)
¶
-
Register the XSPI Transfer Half complete Callback TO be used instead of the weak HAL_XSPI_TxHalfCpltCallback() predefined callback.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
p_callback – Specifies the half transfer complete callback.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter.
HAL_OK – Register completed successfully.
-
hal_status_t
HAL_XSPI_RegisterStatusMatchCallback
(
hal_xspi_handle_t
*
hxspi
,
hal_xspi_cb_t
p_callback
)
¶
-
Register the XSPI Status Match Callback TO be used instead of the weak HAL_XSPI_StatusMatchCallback() predefined callback.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
p_callback – Specifies the status match callback.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter.
HAL_OK – Register completed successfully.
-
hal_status_t
HAL_XSPI_RegisterAbortCpltCallback
(
hal_xspi_handle_t
*
hxspi
,
hal_xspi_cb_t
p_callback
)
¶
-
Register the XSPI Abort complete Callback TO be used instead of the weak HAL_XSPI_AbortCpltCallback() predefined callback.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
p_callback – Specifies the abort complete callback.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter.
HAL_OK – Register completed successfully.
-
hal_status_t
HAL_XSPI_RegisterFifoThresholdCallback
(
hal_xspi_handle_t
*
hxspi
,
hal_xspi_cb_t
p_callback
)
¶
-
Register the XSPI FIFO threshold callback to be used instead of the weak HAL_XSPI_FifoThresholdCallback() predefined callback.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
p_callback – Specifies the FIFO threshold complete callback.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter.
HAL_OK – Register completed successfully.
-
void
HAL_XSPI_SetUserData
(
hal_xspi_handle_t
*
hxspi
,
const
void
*
p_user_data
)
¶
-
Store User Data pointer into the handle.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
p_user_data – Pointer to the user data.
-
const
void
*
HAL_XSPI_GetUserData
(
const
hal_xspi_handle_t
*
hxspi
)
¶
-
Retrieve User Data pointer from the handle.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
- Returns :
-
Pointer to the user data.
-
hal_status_t
HAL_XSPI_SetTxDMA
(
hal_xspi_handle_t
*
hxspi
,
hal_dma_handle_t
*
hdma_tx
)
¶
-
link/store Tx HAL DMA handle into the HAL XSPI handle.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
hdma_tx – Pointer to a hal_dma_handle_t.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter.
HAL_OK – The DMA Tx handle has been successfully linked and stored in the XSPI handle.
-
hal_status_t
HAL_XSPI_SetRxDMA
(
hal_xspi_handle_t
*
hxspi
,
hal_dma_handle_t
*
hdma_rx
)
¶
-
link/store Rx HAL DMA handle into the HAL XSPI handle.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
hdma_rx – Pointer to a hal_dma_handle_t.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter.
HAL_OK – The DMA Rx handle has been successfully linked and stored in the XSPI handle.
-
void
HAL_XSPI_IRQHandler
(
hal_xspi_handle_t
*
hxspi
)
¶
Peripheral current frequency, state and errors functions ¶
- group XSPI_Exported_Functions_Group5
-
This subsection provides a set of functions allowing to read peripheral current frequency, state and last occurred errors.
Functions
-
uint32_t
HAL_XSPI_GetClockFreq
(
const
hal_xspi_handle_t
*
hxspi
)
¶
-
Return the peripheral clock frequency for XSPI.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
- Return values :
-
uint32_t – Frequency in Hz.
0 – source clock of the hxspi not configured or not ready.
-
hal_xspi_state_t
HAL_XSPI_GetState
(
const
hal_xspi_handle_t
*
hxspi
)
¶
-
Retrieve the HAL XSPI Global State.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
- Returns :
-
Retrieve the XSPI global state.
-
uint32_t
HAL_XSPI_GetLastErrorCodes
(
const
hal_xspi_handle_t
*
hxspi
)
¶
-
Return the XSPI error code.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
- Return values :
-
XSPI – error code
-
uint32_t
HAL_XSPI_GetClockFreq
(
const
hal_xspi_handle_t
*
hxspi
)
¶
XSPI Delay Block functions ¶
- group XSPI_Exported_Functions_Group6
-
This subsection provides a set of functions allowing to configure the Delay Block :
Call the function HAL_XSPI_DLYB_SetConfigDelay() to set the delay configuration of the delay block peripheral
Call the function HAL_XSPI_DLYB_GetConfigDelay() to get the delay output clock phase of the delay block peripheral
Call the function HAL_XSPI_DLYB_CalculateMaxClockPhase() to calculate the maximum output clock phase of the delay block peripheral
Call the function HAL_XSPI_DLYB_Enable() to enable the delay block peripheral
Call the function HAL_XSPI_DLYB_Disable() to disable the delay block peripheral
Call the function HAL_XSPI_DLYB_IsEnabled() to check if the delay block peripheral is enabled or not
Functions
-
hal_status_t
HAL_XSPI_DLYB_SetConfigDelay
(
hal_xspi_handle_t
*
hxspi
,
uint32_t
clock_phase_value
)
¶
-
Set the delay configuration of the delay block peripheral.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
clock_phase_value – The desired output clock phase value.
- Return values :
-
HAL_INVALID_PARAM – When no valid XSPI.
HAL_OK – The delay is correctly configured.
-
hal_status_t
HAL_XSPI_DLYB_GetConfigDelay
(
const
hal_xspi_handle_t
*
hxspi
,
uint32_t
*
p_clock_phase
)
¶
-
Get the delay output clock phase of the delay block peripheral.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
p_clock_phase – Pointer to the variable where the selected output clock phase value will be stored.
- Return values :
-
HAL_INVALID_PARAM – When no valid XSPI.
HAL_OK – When the register reading was successful.
-
hal_status_t
HAL_XSPI_DLYB_CalculateMaxClockPhase
(
hal_xspi_handle_t
*
hxspi
,
uint32_t
*
p_max_clock_phase
)
¶
-
Calculate maximum output clock phase of the delay block peripheral.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
p_max_clock_phase – Pointer to the variable where the maximum clock phase value will be stored.
- Return values :
-
HAL_ERROR – The max clock phase is not correctly calculated.
HAL_INVALID_PARAM – When no valid XSPI or invalid p_max_clock_phase parameter.
HAL_OK – The max clock phase is correctly calculated.
-
hal_status_t
HAL_XSPI_DLYB_Enable
(
hal_xspi_handle_t
*
hxspi
)
¶
-
Enable the delay block peripheral.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
- Return values :
-
HAL_ERROR – The delay is not correctly configured.
HAL_INVALID_PARAM – When no valid XSPI instance.
HAL_OK – The delay is correctly configured.
-
hal_status_t
HAL_XSPI_DLYB_Disable
(
hal_xspi_handle_t
*
hxspi
)
¶
-
Disable the delay block peripheral.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
- Return values :
-
HAL_INVALID_PARAM – When no valid XSPI instance.
HAL_OK – The delay block is disabled.
-
hal_xspi_dlyb_status_t
HAL_XSPI_DLYB_IsEnabled
(
const
hal_xspi_handle_t
*
hxspi
)
¶
-
Check if the delay block peripheral is enabled or not.
- Parameters :
-
hxspi – Pointer to a hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.
- Return values :
-
HAL_XSPI_DLYB_ENABLED – The delay block is enabled.
HAL_XSPI_DLYB_DISABLED – The delay block is disabled.
Interrupt functions ¶
- group XSPI_Exported_Functions_Group9
-
Functions
-
void
HAL_XSPI_EnableIT
(
hal_xspi_handle_t
*
hxspi
,
uint32_t
it_source
)
¶
-
Enable the specified XSPI interrupt.
- Parameters :
-
hxspi – specifies the XSPI Handle.
it_source – specifies the XSPI interrupt source to enable This parameter can be any combination of the following values:
HAL_XSPI_IT_TO: XSPI Timeout interrupt
HAL_XSPI_IT_SM: XSPI Status match interrupt
HAL_XSPI_IT_FT: XSPI FIFO threshold interrupt
HAL_XSPI_IT_TC: XSPI Transfer complete interrupt
HAL_XSPI_IT_TE: XSPI Transfer error interrupt
HAL_XSPI_IT_ALL: XSPI All interrupts
-
void
HAL_XSPI_DisableIT
(
hal_xspi_handle_t
*
hxspi
,
uint32_t
it_source
)
¶
-
Disable the specified XSPI interrupt.
- Parameters :
-
hxspi – specifies the XSPI Handle.
it_source – specifies the XSPI interrupt source to disable This parameter can be any combination of the following values:
HAL_XSPI_IT_TO: XSPI Timeout interrupt
HAL_XSPI_IT_SM: XSPI Status match interrupt
HAL_XSPI_IT_FT: XSPI FIFO threshold interrupt
HAL_XSPI_IT_TC: XSPI Transfer complete interrupt
HAL_XSPI_IT_TE: XSPI Transfer error interrupt
HAL_XSPI_IT_ALL: XSPI All interrupts
-
uint32_t
HAL_XSPI_IsEnabledIT
(
const
hal_xspi_handle_t
*
hxspi
,
uint32_t
it_source
)
¶
-
Check whether the specified XSPI interrupt source is enabled or not.
- Parameters :
-
hxspi – specifies the XSPI Handle.
it_source – specifies the XSPI interrupt source to check This parameter can be one of the following values:
HAL_XSPI_IT_TO: XSPI Timeout interrupt
HAL_XSPI_IT_SM: XSPI Status match interrupt
HAL_XSPI_IT_FT: XSPI FIFO threshold interrupt
HAL_XSPI_IT_TC: XSPI Transfer complete interrupt
HAL_XSPI_IT_TE: XSPI Transfer error interrupt
- Returns :
-
retrieve the state of the selected XSPI interrupt.
-
hal_xspi_flag_status_t
HAL_XSPI_IsActiveFlag
(
const
hal_xspi_handle_t
*
hxspi
,
uint32_t
flag
)
¶
-
Check whether the selected XSPI flag is set or not.
- Parameters :
-
hxspi – specifies the XSPI Handle.
flag – specifies the XSPI flag to check This parameter can be one of the following values:
HAL_XSPI_FLAG_BUSY: XSPI Busy flag
HAL_XSPI_FLAG_TO: XSPI Timeout flag
HAL_XSPI_FLAG_SM: XSPI Status match flag
HAL_XSPI_FLAG_FT: XSPI FIFO threshold flag
HAL_XSPI_FLAG_TC: XSPI Transfer complete flag
HAL_XSPI_FLAG_TE: XSPI Transfer error flag
- Returns :
-
retrieve the state of the selected XSPI flag.
-
void
HAL_XSPI_ClearFlag
(
hal_xspi_handle_t
*
hxspi
,
uint32_t
flag
)
¶
-
Clears the specified XSPI’s flag status.
- Parameters :
-
hxspi – specifies the XSPI Handle.
flag – specifies the XSPI clear register flag that needs to be set This parameter can be any combination of the following values:
HAL_XSPI_FLAG_TO: XSPI Timeout flag
HAL_XSPI_FLAG_SM: XSPI Status match flag
HAL_XSPI_FLAG_TC: XSPI Transfer complete flag
HAL_XSPI_FLAG_TE: XSPI Transfer error flag
HAL_XSPI_FLAG_ALL: XSPI All flags
-
void
HAL_XSPI_EnableIT
(
hal_xspi_handle_t
*
hxspi
,
uint32_t
it_source
)
¶